package cn.deschen.eshop.common.config;

import ma.glasnost.orika.MapperFacade;
import ma.glasnost.orika.MapperFactory;
import ma.glasnost.orika.converter.ConverterFactory;
import ma.glasnost.orika.impl.DefaultMapperFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author hanbin_chen
 * @Description 对象映射配置类
 * @DateTime 2021/2/22 15:25
 * @Version V1.0.0
 */
@Configuration
public class OrikaMapperFactoryConfig {

    @Bean
    public MapperFacade createMapperFacade(MapperFactory mapperFactory) {
        return mapperFactory.getMapperFacade();
    }

    @Bean
    public MapperFactory createMapperFactory() {
        MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
        return mapperFactory;
    }
}
